// pages/request/request.js
import http from '../../common/http'
Page({

  /**
   * 页面的初始数据
   */
  data: {

  },
  getRequest() {
    wx.request({
      url: 'http://localhost:3000/products',
      method: "GET",
      data: {},
      header: {
        'content-type': 'application/json'
      },
      success: (res) => {
        console.log(res);
      },
      fail: (err) => {
        console.log(err);
      }
    })
  },
  postRequest() {
    wx.request({
      url: 'http://localhost:3000/products',
      method: "POST",
      data: {},
      header: {
        'content-type': 'application/json'
      },
      success: (res) => {
        console.log(res);
      },
      fail: (err) => {
        console.log(err);
      }
    })
  },
  prom() {
    http({
      url: '/products'
    }).then((res) => {
      console.log(res);
    }).catch((err) => {
      console.log(err);
    })
  },
  th() {
    wx.navigateTo({
      url: '../b/b',
    })
  },

})